/**
 * 
 */
package com.easidea.tim.entity.inventory;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springside.core.dao.extend.Undeletable;

import com.easidea.tim.entity.BaseEntity;

/**
 * 
 * 盘点的差异数据
 * @author Harrison
 *
 */
@Entity(name="tim_inventory_inventory_margin")
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Cache(region="tim_inventory_inventory_margin",usage=CacheConcurrencyStrategy.READ_WRITE)
@Undeletable(status="deleted")
public class InventoryMarginItem extends BaseEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = -341772356676148769L;
	public static final Short MARGIN_TYPE_STORAGE = 1;
	public static final Short MARGIN_TYPE_INVENTORY_ITEM = 2;
	
	private Storage storage;
	private InventoryItem inventoryItem;
	private Double marginNum;
	private Short marginType;
	private Inventory inventory;
	
	/**
	 * @return the storage
	 */
	@OneToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="storage_id")
	public Storage getStorage() {
		return storage;
	}
	/**
	 * @param storage the storage to set
	 */
	public void setStorage(Storage storage) {
		this.storage = storage;
	}
	/**
	 * @return the inventoryItem
	 */
	@OneToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="inventory_item_id",nullable=true)
	public InventoryItem getInventoryItem() {
		return inventoryItem;
	}
	/**
	 * @param inventoryItem the inventoryItem to set
	 */
	public void setInventoryItem(InventoryItem inventoryItem) {
		this.inventoryItem = inventoryItem;
	}
	/**
	 * @return the marginNum
	 */
	@Column(name="marging_num",length=10, precision=2)
	public Double getMarginNum() {
		return marginNum;
	}
	/**
	 * @param marginNum the marginNum to set
	 */
	public void setMarginNum(Double marginNum) {
		this.marginNum = marginNum;
	}
	/**
	 * @return the marginType
	 */
	@Column(name="margin_type")
	public Short getMarginType() {
		return marginType;
	}
	/**
	 * @param marginType the marginType to set
	 */
	public void setMarginType(Short marginType) {
		this.marginType = marginType;
	}
	/**
	 * @return the inventory
	 */
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="inventory_id")
	public Inventory getInventory() {
		return inventory;
	}
	/**
	 * @param inventory the inventory to set
	 */
	public void setInventory(Inventory inventory) {
		this.inventory = inventory;
	}
}
